import { Tag } from "antd";

const STATUS = {
	//通过
	passed: 1,
	//拒绝
	refuse: -1,
	//待审核
	pending: 0
};

const STATUS_INFO = {
	[STATUS.passed]: {
		label: "已通过",
		color: "#0B801E",
		bgColor: "#E5FDE9"
	},
	[STATUS.refuse]: {
		label: "已拒绝",
		color: "#7E7E7E",
		bgColor: "#F3F4F7"
	},
	[STATUS.pending]: {
		label: "待审核",
		color: "#DE6700",
		bgColor: "#FFF8ED"
	}
};

export const TABLE_COLUMNS = [
	{
		title: "微信号",
		dataIndex: "wx",
		width: "40%"
	},
	{
		title: "申请时间",
		dataIndex: "created_at",
		width: "20%"
	},
	{
		title: "通过时间",
		dataIndex: "accept_time",
		width: "20%"
	},
	{
		title: "状态",
		dataIndex: "accept_status",
		width: "10%",
		render: (_: any, record: any) => {
			const status: any = record?.accept_status;
			const info = STATUS_INFO[status];
			const bgColor = info?.bgColor;
			const color = info?.color;

			return <Tag style={{ background: bgColor, color, border: "none", marginRight: 0 }}>{info?.label}</Tag>;
		}
	}
];
